package cn.suzhang.designpatterns.component;

import java.util.LinkedList;
import java.util.List;

public class FolderFileComposite extends AbstractFileComponent {

	private List<AbstractFileComponent> fileList=new LinkedList<AbstractFileComponent>();
	
	public FolderFileComposite(String fileName) {
		super(fileName);
	}

	@Override
	protected void add(AbstractFileComponent fileComponent) {
		fileList.add(fileComponent);
	}

	@Override
	protected void remove(AbstractFileComponent fileComponent) {
		fileList.remove(fileComponent);
	}

	@Override
	protected void killVirus() {
		for (AbstractFileComponent fileComponent : fileList) {
			fileComponent.killVirus();
		}
	}

}
